Use cache->buffer, not cache.
authorMatthias Clasen <mclasen@redhat.com>
Fri, 8 Apr 2005 21:01:21 +0000 (21:01 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Fri, 8 Apr 2005 21:01:21 +0000 (21:01 +0000)
2005-04-08  Matthias Clasen  <mclasen@redhat.com>

* xdgmimecache.c (cache_magic_matchlet_compare_to_data)
(cache_magic_matchlet_compare): Use cache->buffer, not
cache.

gtk/xdgmime/ChangeLog
gtk/xdgmime/xdgmimecache.c

index 949cc5927ecbd793214179ce4d982baafbe4867e..1cd2486fe27c79dc1ef80c888c2013ff4ac954e3 100644 (file)
@@ -1,3 +1,9 @@
+2005-04-08  Matthias Clasen  <mclasen@redhat.com>
+
+       * xdgmimecache.c (cache_magic_matchlet_compare_to_data) 
+       (cache_magic_matchlet_compare): Use cache->buffer, not 
+       cache.  
+
 Tue Apr  5 16:00:04 2005  Manish Singh  <yosh@gimp.org>
 
        * Makefile.am: add xdgmimecache.[ch].
index dba7c399047161f04d58dbb47aabc13ef0616d36..bfa02862b559cbd243bffe50b46966432d5f27ee 100644 (file)
@@ -79,8 +79,8 @@ struct _XdgMimeCache
   char   *buffer;
 };
 
-#define GET_UINT16(cache,offset) (ntohs(*(uint16_t*)&(cache)[offset]))
-#define GET_UINT32(cache,offset) (ntohl(*(uint32_t*)&(cache)[offset]))
+#define GET_UINT16(cache,offset) (ntohs(*(uint16_t*)((cache) + (offset))))
+#define GET_UINT32(cache,offset) (ntohl(*(uint32_t*)((cache) + (offset))))
 
 XdgMimeCache *
 _xdg_mime_cache_ref (XdgMimeCache *cache)
@@ -156,11 +156,11 @@ cache_magic_matchlet_compare_to_data (XdgMimeCache *cache,
                                      const void   *data,
                                      size_t        len)
 {
-  xdg_uint32_t range_start = GET_UINT32 (cache, offset);
-  xdg_uint32_t range_length = GET_UINT32 (cache, offset + 4);
-  xdg_uint32_t data_length = GET_UINT32 (cache, offset + 12);
-  xdg_uint32_t data_offset = GET_UINT32 (cache, offset + 16);
-  xdg_uint32_t mask_offset = GET_UINT32 (cache, offset + 20);
+  xdg_uint32_t range_start = GET_UINT32 (cache->buffer, offset);
+  xdg_uint32_t range_length = GET_UINT32 (cache->buffer, offset + 4);
+  xdg_uint32_t data_length = GET_UINT32 (cache->buffer, offset + 12);
+  xdg_uint32_t data_offset = GET_UINT32 (cache->buffer, offset + 16);
+  xdg_uint32_t mask_offset = GET_UINT32 (cache->buffer, offset + 20);
   
   int i, j;
 
@@ -208,9 +208,9 @@ cache_magic_matchlet_compare (XdgMimeCache *cache,
                              const void   *data,
                              size_t        len)
 {
-  xdg_uint32_t n_children = GET_UINT32 (cache, offset + 24);
-  xdg_uint32_t child_offset = GET_UINT32 (cache, offset + 28);
-  
+  xdg_uint32_t n_children = GET_UINT32 (cache->buffer, offset + 24);
+  xdg_uint32_t child_offset = GET_UINT32 (cache->buffer, offset + 28);
+
   int i;
   
   if (cache_magic_matchlet_compare_to_data (cache, offset, data, len))